from rest_framework import serializers

from questions.models import Label
from questions.serializer.question import QuestionSerializerForList


class LabelsSerializer(serializers.ModelSerializer):
    '''标签序列化器'''

    class Meta:
        model = Label
        fields = ['id','label_name']



class LabelSerializerWithQuestionAndArticle(serializers.ModelSerializer):
    '''标签详情序列化器'''

    questions = QuestionSerializerForList(many=True, read_only=True)
    class Meta:
        model = Label
        fields = '__all__'